package com.cxb.receiver;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import com.cxb.entity.EventBusMessage;
import com.cxb.entity.PhoneSigal;
import de.greenrobot.event.EventBus;

public class SigalChangeReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {

		PhoneSigal phoneSigal = new PhoneSigal();
		boolean isConnected = intent.getBooleanExtra("connected", false);
		int level = intent.getIntExtra("level", 0);
//		int networkType = intent.getIntExtra("networkType", 0);
		phoneSigal.setConnected(isConnected);
		phoneSigal.setLevel(level);
//		phoneSigal.setNetworkType(networkType);

		EventBus.getDefault().post(
				new EventBusMessage(EventBusMessage.EVENT_PHONE_SIGAL_CHANGE,
						phoneSigal));

	}
}
